package cn.wangkai.peanut.db.iface;

import java.sql.Connection;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import cn.wangkai.peanut.db.WKDbException;


public interface IDb {
	
	public final static int DB_MYSQL=1;
	public final static int DB_SQLSERVER=2;
	public final static int DB_DB2=3;
	public final static int DB_ORACLE=4;
	public final static int DB_SQLSERVER2005=5;
	public final static int DB_INTPLE=6;


	/**
	 * 连接池启
	 * @throws Exception
	 */
	public void VStartPool();
	
	/**
	 * 初始化连接池
	 * @param name
	 */
	public void VStartPool(String name);
	
	/**
	 * 释放连接池
	 */
	public void ShutdownPool();

	/**
	 * 获得数据库连
	 */
	public Connection getConnection() throws WKDbException ;
	/**
	 * 获取数据库类型
	 * @param dbtype
	 * @return
	 */
	public int getDbtype(int dbtype);
	/**
	 * 获取数据库类型
	 * @return
	 */
	public int getDbtype();
	/**
	 * 得到一个连接
	 * @param defalutname
	 * @return
	 */
	public ComboPooledDataSource StartPool(String defalutname);
	/**
	 * 获得数据库类型
	 */
	public ComboPooledDataSource getDs();
	/**
	 * 设置一个连接串
	 * @param cds
	 */
	public void setDs(ComboPooledDataSource cds);

}
